package net.mywardrobes.manageclothescategory;

import java.util.List;

import javax.jws.WebService;

import net.mywardrobes.clothescategory.ClothesCategory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;

//@Transactional
@Service("manageClothesCategoryServiceImpl")
@WebService(serviceName = "ManageClothesCategoryService", portName = "ManageClothesCategoryServicePort", endpointInterface = "net.mywardrobes.manageclothescategory.ManageClothesCategoryService", targetNamespace = "http://www.mywardrobes.net/ManageClothesCategory/")
public class ManageClothesCategoryServiceImpl extends SpringBeanAutowiringSupport implements ManageClothesCategoryService {

	private GenericHibernateDao genericHibernateDao;

	@Autowired
	public void setGenericHibernateDao(GenericHibernateDao genericHibernateDao) {
		this.genericHibernateDao = genericHibernateDao;
	}

	@Override
	@Transactional
	public ClothesCategory addClothesCategory(ClothesCategory in) {
		if (in.getParentCategory() != null && in.getParentCategory().getClothesCategoryId() == null) {
			in.setParentCategory(null);
		}
		System.out.println("genericHibernateDao: " + genericHibernateDao);
		ClothesCategory cc = null;
		cc = (ClothesCategory) genericHibernateDao.save(in);

		return cc;

	}

	@Override
	public ClothesCategory getClothesCategory(String in) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<ClothesCategory> listClothesCategory() {
		// TODO Auto-generated method stub
		return null;
	}

}
